/*
 * Filename Interface.h
*/

#ifndef __DEEP_ZOOM_IMAGE_INTERFACE_H__
#define __DEEP_ZOOM_IMAGE_INTERFACE_H__

#include "DeepZoomImageDLL.h"
#include "deepzoomimagetilesource.h"
#include "multiscaleimage.h"

namespace DeepZoomImage
{
	class DEEP_ZOOM_IMAGE_DLL IDeepZoomInterface
	{
	public:
		IDeepZoomInterface()
		{

		}
		~IDeepZoomInterface()
		{

		}
		virtual void UpdataRender(int width,int height,unsigned char* buffer) = 0;
	};
	class DEEP_ZOOM_IMAGE_DLL IDeepZoomImage
	{
	public:

		typedef struct tagCAIROSURFACEINFO
		{

			unsigned char* mSurfaceData;

			int            mSurfaceWidth;
			int            mSurfaceHeight;
			//int            mSurfaceStride;
		}CairoSurfaceInfo;


		IDeepZoomImage();
		virtual ~IDeepZoomImage();

		bool Initialize();
		void SetCairoSurfaceInfo(int width,int height,unsigned char* buffer);
		void UpdataRender();

		void SetImageMove(double posX,double posY);
		void SetImageZoom(double zDelta,double posX,double posY);

		void SetWindowSize(int windowWidth,int windowHeight);
		void SetImagePath(const char* filePath);

		void Unload();

		Point* GetAnimatedViewportOrigin();
		double Getviewportwidth();
		double GetActualWidth();

	private:
		void MouseMoveEvent();
		void MouseWheelEvent(int posX,int posY);

	private:
		DeepZoomImageTileSource* m_pDZITS;
		MultiScaleImage*  m_pMSI;
		bool m_bInitFinish;
		CairoSurfaceInfo* m_pSurfaceInfo;

		int m_mousePosX;
		int m_mousePosY;

		int m_windowWidth;
		int m_windowHeight;

		bool m_bIsScale;
		bool m_bIsPanning;
		double m_scale;
		double m_ratio;
		double m_vp_w;
		double m_actualWidth;
		Point m_pos;
		Point m_mousePos;

		IDeepZoomInterface* m_pInterface;
	};
}

#endif /*__DEEP_ZOOM_IMAGE_INTERFACE_H__*/
